(function (aopc) {
    aopc.addExpandPage(800, function (get) {
        const Common = get('UtilsCommon', 'Common');
        return {
            expandInit() {
                this.meetingRecords = this.getProperty('MeetingRecords');
            },
            getMeetingId() {
                const { UserId } = this.visitUser;
                return { pathQuery: `?$orderby=CreateDate desc&$filter=RecordType eq 3 and MeetingId eq @MeetingId and CreateUser eq @CreateUser&@MeetingId=${this.pageData.MeetingId}&@CreateUser=${UserId}` };
            },
            refreshDataList() {
                this.meetingRecords.id = Common.createGuid();
                this.meetingRecords.isCache = false;
                this.meetingRecords.refreshOptions();
            },
            deleteRecord({ property }) {
                if (property.isLoading) return;
                this.confirm('确定要删除该会议笔记吗？', () => {
                    const { serviceInterface, data } = property;
                    const { serviceName, actionName } = serviceInterface;

                    const { RecordId, RowVersion } = data;

                    const payload = { url: `MeetingRecord(${RecordId})?RowVersion=${RowVersion}` }

                    property.isLoading = true;
                    this.dispatchAction(serviceName, actionName, payload).then(res => {
                        property.isLoading = false;
                        if (res.isSuccess !== false) {
                            this.alertSuccess('删除成功！', () => {
                                this.refreshDataList();
                            });
                        }
                    });
                });
            },
        }
    });
})(window.aopc);